10 DEFINT A-Z:DIM G(1643):KEY OFF:SW=320:SH=200
20 VGA=1:ON ERROR GOTO 200:SCREEN 11:ON ERROR GOTO 0
30 IF VGA=1 THEN SW=640:SH=480 ELSE SCREEN 1
40 D=FIX(LOG(SH)/LOG(3)):SC=SH\(3^D):S=SC*(3^D):X=(SW-S)/2:Y=(SH-S)/2
50 LINE(X,Y)-(X+SC*3-1,Y+SC*3-1),3,BF:LINE(X+SC,Y+SC)-(X+SC*2-1,Y+SC*2-1),0,BF
60 FOR N=1 TO D-1:GOSUB 100:NEXT N
70 WHILE INPUT$(1)="":WEND:SCREEN 0:WIDTH 80:CLS:END
100 S=3^N*SC:GET (X,Y)-(X+S-1,Y+S-1),G
110 PUT (X+S,Y),G:PUT (X+S*2,Y),G:PUT (X,Y+S),G:PUT (X+S*2,Y+S),G
120 FOR I=0 TO 2:PUT (X+S*I,Y+S*2),G:NEXT I:RETURN
200 IF ERR=5 THEN VGA=0:RESUME NEXT ELSE ON ERROR GOTO 0
